﻿using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Super.Hmi.Converters
{
    /// <summary>
    /// 将层级转换为缩进的转换器
    /// </summary>
    public class LevelToIndentConverter : IValueConverter
    {
        private const double IndentPerLevel = 15;
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is int level && level > 0)
            {
                return new Thickness(level * IndentPerLevel, 0, 0, 0);
            }
            return new Thickness(0);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
